package ast.nodes;

import scanner.Token;
import scanner.TokenType;
import ast.ASTNode;
import ast.Evaluation;

public class BeginNode extends ASTNode {

    public BeginNode() {
        super(new Token("BEGIN", TokenType.BEGIN));
    }
    
    public BeginNode(Token data)
    {
        super(data);
    }

    @Override
    public String toString(int depth) {
        String actionList = "";
        for (ASTNode action: getChildren()) {
            actionList = action.toString(depth+1);
        }

        return indent(depth) + "BEGIN:" + actionList;
    }

    @Override
    public void run(Evaluation input) throws Exception {
        for(ASTNode child  : children)
            child.run(input);
    }

}
